(function($) {
	var defaults = {
		menus : [
				{
					href : '../home/index.html' ,
					title : '首页'
				} , {
					href : '../report/reportlist.html' ,
					title : '收货' ,
					active : true
				}
		] ,
		currentPage : {
			href : '../report/reportlist.html' ,
			title : '收货'
		}
	};

	var methods = {
		init : function(opts) {
			this.uiPageHeader = $(this);
			this.uiPageHeader.addClass("breadcrumb-wrapper");
			methods.createMenu.apply(this, [
				opts.menus
			]);
			$('<li class="page-title">'+opts.currentPage.title+'</li>').appendTo(this.uiPageHeader);
		} ,
		createMenu : function(menus) {
			var self = this;
			if (menus != null) {
				var ul = self;
				$.each(menus, function(item, rows) {
					var li = $('<li></li>');
					var a = '<a href="' + this.href + '"';
					if (this.active) {
						a+=' class="active" ';
					}
					a += '> <ins><div class="br-left"></div><div class="br-mid">' + this.title + '</div><div class="br-right"></div></ins></a>';

					$(a).appendTo(li);
					li.appendTo(ul);
				});
				return ul;
			} else {
				return null;
			}
		}
	};
	$.fn.pageHeader = function(opts) {
		var options = $.extend(defaults, opts);
		var args = arguments;
		return this.each(function(index) {
			if (methods[opts]) {
				var ar = Array.prototype.slice.call(args, 1);
				return methods[opts].apply(this, ar);
			} else if (typeof opts === 'object' || !opts) {
				return methods.init.apply(this, [
					options
				]);
			} else {
				$.error('Method ' + method + ' does not exist on jQuery.tooltip');
			}
		});
	};
})(jQuery);